package com.cckj.projectapi;

import com.cckj.common.utils.SpringUtil;
import com.cckj.common.utils.ThreadPoolUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan("com.cckj")
@MapperScan("com.cckj.common.module")
public class ProjectApiApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext run = SpringApplication.run(ProjectApiApplication.class, args);
		SpringUtil.setApplicationContext(run);
		// 停止应用时，关闭线程池钩子，或者使用 @PreDestroy 注解执行一系列操作
		Runtime.getRuntime().addShutdownHook(new Thread(ThreadPoolUtils::shutdown, "ShutdownThreadPoolHook"));
	}

}
